package section_08.simulation.bankTellerSimulation;

import java.util.Random;
import java.util.concurrent.TimeUnit;

public class CustomerGenerator implements Runnable{
	private CustomerLine customers;
	private static Random rand = new Random(47);
	public CustomerGenerator(CustomerLine cq){
		customers = cq;
	}
	public void run(){
		try{
			while(!Thread.interrupted()){
				TimeUnit.MICROSECONDS.sleep(rand.nextInt(300));
				customers.put(new Customer(rand.nextInt(1000)));
			}
		}catch(InterruptedException e){
			System.out.println("CustomerGenerator interrupted");
		}
		System.out.println("CustomerGenerator terminating");
	}
}
